home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / screen / entpass.frm (.txt) next >
Encoding:
Visual Basic Form  |  1994-11-28  |  3.7 KB  |  130 lines

  1. VERSION 2.00
  2. Begin Form frmEnterPass 
  3.    BorderStyle     =   3  'Fixed Double
  4.    ClientHeight    =   2265
  5.    ClientLeft      =   1065
  6.    ClientTop       =   1515
  7.    ClientWidth     =   4095
  8.    ControlBox      =   0   'False
  9.    Height          =   2670
  10.    Left            =   1005
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2265
  15.    ScaleWidth      =   4095
  16.    Top             =   1170
  17.    Width           =   4215
  18.    Begin Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   30000
  21.       Left            =   2220
  22.       Top             =   1680
  23.    End
  24.    Begin CommandButton cmdCancel 
  25.       Cancel          =   -1  'True
  26.       Caption         =   "Cancel"
  27.       Height          =   375
  28.       Left            =   2820
  29.       TabIndex        =   2
  30.       Top             =   1740
  31.       Width           =   1095
  32.    End
  33.    Begin CommandButton cmdOK 
  34.       Caption         =   "OK"
  35.       Default         =   -1  'True
  36.       Height          =   375
  37.       Left            =   720
  38.       TabIndex        =   1
  39.       Top             =   1740
  40.       Width           =   1095
  41.    End
  42.    Begin TextBox txtPassword 
  43.       Height          =   285
  44.       Left            =   1860
  45.       MaxLength       =   20
  46.       PasswordChar    =   "*"
  47.       TabIndex        =   0
  48.       Top             =   1260
  49.       Width           =   2055
  50.    End
  51.    Begin Label Label2 
  52.       Caption         =   "Password:"
  53.       Height          =   195
  54.       Left            =   720
  55.       TabIndex        =   4
  56.       Top             =   1320
  57.       Width           =   975
  58.    End
  59.    Begin Label Label1 
  60.       Caption         =   "The screen saver you are using is password protected. You must type in the screen saver password to turn off the screen saver."
  61.       Height          =   855
  62.       Left            =   720
  63.       TabIndex        =   3
  64.       Top             =   120
  65.       Width           =   3255
  66.    End
  67.    Begin Image imgIcon 
  68.       Height          =   480
  69.       Left            =   120
  70.       Picture         =   ENTPASS.FRX:0000
  71.       Top             =   120
  72.       Width           =   480
  73.    End
  74. Option Explicit
  75. Dim FirstTime As Integer
  76. Sub cmdCancel_Click ()
  77.     ValidPassword = 2 ' Password canceled
  78.     Unload Me
  79. End Sub
  80. Sub cmdOK_Click ()
  81.     If CalcPassnum(UCase$(txtPassword.Text)) = Password Then
  82.         ValidPassword = 1 ' Password valid
  83.     Else
  84.         ValidPassword = 3 ' Password invalid
  85.     End If
  86.     Unload Me
  87. End Sub
  88. Sub Form_Activate ()
  89.     If FirstTime Then
  90.         FirstTime = False
  91.         txtPassword.SetFocus
  92.     End If
  93. End Sub
  94. Sub Form_Load ()
  95.     Dim i As Integer
  96.     FirstTime = True
  97.     Caption = SaverName
  98.     CentreForm Me
  99.     ValidPassword = 0 ' Set to a known value
  100.     timer1.Enabled = True ' Start the timer
  101.     ' Set the Form to be TopMost
  102.     SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, 3
  103.     ' Set the Form to be System Modal (Ouch!)
  104.     i = SetSysModalWindow(hWnd)
  105. End Sub
  106. Sub Form_Unload (Cancel As Integer)
  107.     timer1.Enabled = False ' Cancel the timer explicitly
  108.     '
  109.     ' If Alt-F4 or the control box is clicked then
  110.     ' set ValidPassword to Canceled
  111.     '
  112.     If ValidPassword = 0 Then ValidPassword = 2
  113. End Sub
  114. Sub Timer1_Timer ()
  115.     '
  116.     ' if we have had no activity for 30 seconds then
  117.     ' let the screen saver get on with it.
  118.     '
  119.     Unload Me
  120. End Sub
  121. Sub txtPassword_KeyPress (KeyAscii As Integer)
  122.     '
  123.     ' The user has typed something so reset the counter
  124.     ' to 30 seconds and start counting again
  125.     '
  126.     timer1.Enabled = False
  127.     timer1.Interval = 30000
  128.     timer1.Enabled = True
  129. End Sub
  130.